package com.qf.smsplatform.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket docket(){
        // 在线文档首页的描述
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("缓存模块接口")
                .description("缓存模块接口")
                .contact(new Contact("郑大仙丶","http://www.baidu.com","10000@qq.com"))
                .version("v1.0.0")
                .build();

        // 创建Docket,注入apiInfo,指定哪些包下的接口生成文档
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .select()
//                    .apis()   指定哪些包下的类生成
//                    .paths()  哪些路径生成文档
                .build();

        // 返回
        return docket;
    }
}
